import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
//  导入刚才编写的组件
import index from '@/components/home/index'
import Login from '@/components/Login'
import Book from '@/components/Book'
import Manage from '@/components/Manage'
import Home from '@/components/Home'
import Manage_import from '@/components/Manage_import'
import LibraryIndex from '@/components/library/LibraryIndex'
import Manage_vistor from '@/components/Manage_vistor'
import Show from '@/components/library/Show';
import test from '@/components/library/test'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path: '/test',
      name: 'Test',
      component: test
    },
    {
      path: '/home',
      name: 'Home',
      component: Home,
      //  home页面并不需要被访问
      redirect: '/index',
      children: [
        {
          path: '/book',
          name: 'Book',
          component: Book,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/library',
          name: 'Library',
          component: LibraryIndex,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/show',
          name: 'Show',
          component: Show,
          meta: {
            requireAuth: true
          }
        }
      ]
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/index',
      name: 'Index',
      component: index
    },
    {
      path: '/manage',
      name: 'manage',
      component: Manage
    },
    {
      path: '/manage_import',
      name: 'manage_import',
      component: Manage_import
    },
    {
      path: '/manage_vistor',
      name: 'manage_vistor',
      component: Manage_vistor
    }
  ]
})
